﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using DDOS.Objects.Projectiles;

namespace DDOS.Objects
{
    public class HealAllyGambit : Gambit
    {
        public HealAllyGambit(GambitCondition gc)
            : base(gc)
        {
        }

        public override void Activate(GameObject self, GameObject other)
        {
            Entity selfEnt = (Entity)self;
            Vector2 vel = (other.Coordinates - self.Coordinates);
            if (vel.Length() > 300)
            {
                vel.Normalize();
                self.Coordinates += vel * (float)((Entity)self).Speed;
            }
            else
            {
                if (self.GetType() == typeof(Minion))
                {
                    if (((Minion)self).shootDelay <= 0)
                    {
                        Projectile0 bullet = new Projectile0(-1, 5, other.Coordinates, (Entity)self);
                        bullet.InitializeComponents();
                        bullet.fire();
                        ((Minion)self).bullets.Add(bullet);
                        ((Minion)self).shootDelay = 2000;
                    }
                }
                /*if (self.GetType() == typeof(Enemy0))
                {
                    if (((Minion)self).shootDelay <= 0)
                    {
                        Projectile0 bullet = new Projectile0(1, 5, other.Coordinates);
                        bullet.InitializeComponents();
                        bullet.fire();
                        ((Minion)self).bullets.Add(bullet);
                    }
                }*/
            }
        }

        public override string ToString()
        {
            return base.ToString() + "Heal Target";
        }
    }
}
